//
//  ViewController.m
//  Class
//
//  Created by 钟纪旺 on 17/3/15.
//  Copyright © 2017年 zjw. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *LeftConstant;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *RightConstant;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.'
    
    self.RightConstant.constant =self.LeftConstant.constant - self.view.bounds.size.width;
    self.LeftConstant.constant = self.view.bounds.size.width;
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"点击就送屠龙宝刀" style:UIBarButtonItemStylePlain target:self action:@selector(onMarniu:)];
}
- (void)onMarniu:(id)sender{
    if (_RightConstant.constant ==0) {
        [UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveLinear animations: ^{
            self.RightConstant.constant =self.LeftConstant.constant - self.view.bounds.size.width;
            self.LeftConstant.constant = self.view.bounds.size.width;
            [self.view layoutIfNeeded];
        } completion:nil];
    }else{
        [UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveLinear animations: ^{
            self.LeftConstant.constant = self.RightConstant.constant +self.view.bounds.size.width;
            self.RightConstant.constant =0;
            [self.view layoutIfNeeded];
        } completion:nil];
    }
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;


}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    cell.textLabel.text = @"◥▇▆▅︻︻  喏   给你";
    return cell;




}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
